package cn.gson.springboot.controllers;

import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import cn.gson.springboot.model.pojos.Section;
import cn.gson.springboot.model.service.ApplyHosptialServices;
import cn.gson.springboot.model.service.DrugstorageService;
import cn.gson.springboot.model.service.SectionService;
import cn.gson.springboot.model.service.UserService;
import cn.gson.springboot.model.vo.AdviceVo;
import cn.gson.springboot.model.vo.DrugfyVo;

@Controller
public class InHospitalController {
	
	@Autowired
	private ApplyHosptialServices applyser;	//住院所有的service
	
	@Autowired
	private UserService us;//用户表的service
	
	
	//打印小票
	@PostMapping("find-receipt")
	@ResponseBody
	public JSONArray selectapplyreceipt() {
		return applyser.selectapplyreceipt();
	}
	
	//进入住院通知界面
	@RequestMapping("inhospital-inform")
	public String inHospitalInorm(Model model) {
		//生成随机数形成住院号
		int hospid=(int)((Math.random()*4+1)*100000);
		model.addAttribute("hospid", hospid);
		//生成随机数形成医疗卡号
		int clinicid=(int)((Math.random()*4+1)*100000);
		model.addAttribute("clinicid", clinicid);
		//入院时间
		Timestamp d = new Timestamp(System.currentTimeMillis());
		model.addAttribute("time",d);
		return "inhospital-inform";
	}
	
	//查询通知单号得到联合查询的值
	@PostMapping("find-applyByid")
	@ResponseBody
	public String findapplyByid(Integer applyid){
		//查询通知单号的方法
		JSONArray applyById = applyser.findApplyById(applyid);
		JSONObject json = new JSONObject();
		json.put("result",applyById);
		return json.toJSONString();
	}
	
	//修改通知单的通知状态
	@PostMapping("update-infromstatus")
	@ResponseBody
	public void updateinfromstatus(@RequestParam("apply_id")Integer apply_id,
			@RequestParam("infrom_status")String infrom_status) {
		Integer status = null;
		if("未处理".equals(infrom_status)) {
			 status = 1;
		}
		applyser.updateApplyStatus(status,apply_id);
	}
	
	//初始化通知单表格数据
	@PostMapping("hosp-applyrecordall")
	@ResponseBody
	public Map<String,Object>  findApplyRecord(
			@RequestParam("page")int page,
			@RequestParam("rows")int rows,String clinicname,Integer applyid){
		//进行分页
		 Page<Object> pg = PageHelper.startPage(page, rows);
		 JSONArray applyall = applyser.findapplyrecordAll(clinicname,applyid);
		//进行数据格式转换和封装
		Map<String,Object> map = new HashMap<>();
		map.put("total", pg.getTotal());//封装总记录数
		map.put("rows", applyall);//封装当前页的内容
		return map;
	}
	
	//进入住院界面
	@RequestMapping("inhospital")
	public String inHospital(Model model,Integer sectionid) {
		//生成随机数形成住院号
		int hospid=(int)((Math.random()*4+1)*100000);
		model.addAttribute("hospid", hospid);
		//入院时间
		Timestamp d = new Timestamp(System.currentTimeMillis());
		model.addAttribute("time",d);
		return "inhospital";
	}
	
	//根据已同意的通知单号查询
	@PostMapping("find-applyRegByid")
	@ResponseBody
	public String findApplyByidReg(Integer applyid) {
		//查询已同意的通知单号的方法
		JSONObject json = new JSONObject();
		JSONArray selectapply = applyser.findApplyByidReg(applyid);
		json.put("result",selectapply);
		return json.toJSONString();
	}
	
	
	//科室初始化
	@PostMapping("init-zhsetion")
	@ResponseBody
	public JSONArray selectzhsectionid(String sname) {
		return us.selectzhsectionid(sname);
	}
	//科室初始化2
	@RequestMapping("init-hospsection")
	@ResponseBody
	public JSONArray initsection() {
		return us.selectUserSectionAll();
	}
	
	//初始化科室，用于新增床位
	@RequestMapping("init-sectionAll")
	@ResponseBody
	public JSONArray selectAllsection() {
		return applyser.selectSectionAll();
	}

	
	//医生初始化
	@PostMapping("init-hospuserdoctor")
	@ResponseBody
	public JSONArray inituserdoctor(Integer sid) {
		return us.selectUserDoctorAll(sid);
	}
	
	//护士初始化
	@RequestMapping("init-hospusernurse")
	@ResponseBody
	public JSONArray initusernurse(Integer sid) {
		return us.selectUserNurseAll(sid);
	}
	
	
	
	//初始化病房(用户新增床位)
	@PostMapping("init-sickroom")
	@ResponseBody
	public JSONArray initSickRoom(Integer sid) {
		return applyser.selectRoomAll(sid);
	}
	
	//初始化病房（用于安排床位）
	@PostMapping("init-sickroombed")
	@ResponseBody
	public JSONArray initSickRoomBed(Integer sid) {
		return applyser.selectRoomBedAll(sid);
	}
	
	//查询床位号所属的病房
	@PostMapping("select-roombedno")
	@ResponseBody
	public JSONArray selectRoomBedByid(Integer roomid) {
		System.out.println("住院登记的病房号："+roomid);
		return applyser.selectRoomBedByid(roomid);
	}
	
	//床位号初始化
	@RequestMapping("init-bedno")
	@ResponseBody
	public JSONArray initBed() {
		return applyser.selectBedSickRoomAll();
	}
		
	
	
	//新增从门诊传过来的住院登记的方法
	@PostMapping("add-inform")
	public void inform(String cliniccardId,String clinicName,
			Integer hospdoctorname,String hospId,String sectionname,
			Integer hospnursename,Integer sickroomId,
			Integer bedId,BigDecimal cashMoney, String hospTime,String hospPeople) {
		
		//新增住院登记（登记表，押金表，床位表，医疗卡表）[从门诊新增]
		applyser.AddHospRegsiter(cliniccardId, clinicName, 
				hospdoctorname, hospId, sectionname, 
				hospnursename, sickroomId, bedId, 
				cashMoney, hospTime, hospPeople);
		
	}
	
	//住院自主登记的方法
	@PostMapping("add-hospregsiter")
	public void addHospregsiter(String clinicName,String cliniccardId, String clinicIdnumber,
			Integer clinicAge,String clinicAddress,String clinicTel,
			String clinicHandlename,BigDecimal clinicRemainmoney,String clinicSex,
			Integer hospdoctorname,Integer hospnursename,
			String hospId,Integer bedId,BigDecimal cashMoney,String hospPeople) {
			
		//新增住院登记（登记表，押金表，床位表，医疗卡表）[自主新增]	
		applyser.AddHospReg(clinicName, cliniccardId, clinicIdnumber, 
				clinicAge, clinicAddress, clinicTel, clinicHandlename, 
				clinicRemainmoney, clinicSex, hospdoctorname, 
				hospnursename, hospId, bedId, cashMoney, hospPeople);
		
	}
	
	//初始化住院登记记录表格的数据
	@PostMapping("reg-hosprecord")
	@ResponseBody
	public Map<String,Object>  findHosp(
			@RequestParam("page")int page,
			@RequestParam("rows")int rows,String clinicname,String hospid){
		//进行分页
		Page<Object> pg = PageHelper.startPage(page, rows);
		JSONArray findhospRecored = applyser.findhospRecored(clinicname,hospid);
		//进行数据格式转换和封装
		Map<String,Object> map = new HashMap<>();
		map.put("total", pg.getTotal());//封装总记录数
		map.put("rows", findhospRecored);//封装当前页的内容
		return map;
	}
	
	//医生站的病人信息，和登录人是否是这个主治医生有关系  
	@PostMapping("reg-hosprecorddoctor")
	@ResponseBody
	public Map<String,Object>  findRegRecordAndDoctor(
			@RequestParam("page")int page,
			@RequestParam("rows")int rows,String doctorname){
		System.out.println("登录人："+doctorname);
		//进行分页
		Page<Object> pg = PageHelper.startPage(page, rows);
		JSONArray findhospRecoreddoc = applyser.findRegRecordAndDoctor(doctorname);
		//进行数据格式转换和封装
		Map<String,Object> map = new HashMap<>();
		map.put("total", pg.getTotal());//封装总记录数
		map.put("rows", findhospRecoreddoc);//封装当前页的内容
		return map;
	}
	
	
	//进入医生工作站管理界面
	@RequestMapping("in-doctorstand")
	public void inDoctorStand() {
		
	}
	
	//手术室初始化
	@RequestMapping("init-opreationRoom")
	@ResponseBody
	public JSONArray initopreationRoom() {
		return applyser.selectOpreationRoomAll();
	}
	
	//手术类型的初始化
	@PostMapping("init-opreationType")
	@ResponseBody
	public  Map<String,Object>  initopreationType(
			@RequestParam("page")int page,
			@RequestParam("rows")int rows, Integer oprid){
			//进行分页
			Page<Object> pg = PageHelper.startPage(page, rows);
			JSONArray findopaproject = applyser.selectOpreationTypeAll(oprid);
			//进行数据格式转换和封装
			Map<String,Object> map = new HashMap<>();
			map.put("total", pg.getTotal());//封装总记录数
			map.put("rows", findopaproject);//封装当前页的内容
			return map;
			
	}

	
	//查询所有药品
	@RequestMapping("findall-hospdrug")
	@ResponseBody
	public  Map<String,Object>  Findalldrug(
			@RequestParam("page")int page,
			@RequestParam("rows")int rows, String drugname,String drugtype){
			//进行分页
			Page<Object> pg = PageHelper.startPage(page, rows);
			JSONArray findAllDrug = applyser.selecthospdrugkucun(drugname,drugtype);
			//进行数据格式转换和封装
			Map<String,Object> map = new HashMap<>();
			map.put("total", pg.getTotal());//封装总记录数
			map.put("rows", findAllDrug);//封装当前页的内容
			return map;
			
	}

	
	//初始化体检项目的数据
	@RequestMapping("init-healproject")
	@ResponseBody
	public JSONArray inithealproject(String peojectname){
		return applyser.selectHealBysid(peojectname);
	}
	
	//初始化病例记录
	@PostMapping("find-case")
	@ResponseBody
	public  Map<String,Object>  findHospCase(
			@RequestParam("page")int page,
			@RequestParam("rows")int rows, String clinicname){
			//进行分页
			Page<Object> pg = PageHelper.startPage(page, rows);
			JSONArray findAllDrug = applyser.selectHospCase(clinicname);
			//进行数据格式转换和封装
			Map<String,Object> map = new HashMap<>();
			map.put("total", pg.getTotal());//封装总记录数
			map.put("rows", findAllDrug);//封装当前页的内容
			return map;
			
	}
		
	//开立医嘱（新增医嘱表，医嘱详情表，住院表）
	@PostMapping("add-openadvice")
	@ResponseBody
	public String AddopenAdvice(AdviceVo advvo){
		String advice = applyser.saveOrder(advvo);
		
		if("".equals(advice)) {
			return "开立医嘱成功";
		}
		return advice;
    }

	//初始化医嘱（查询医嘱）
	@PostMapping("find-adviceall")
	@ResponseBody
	public Map<String,Object>  findAdviceAll(@RequestParam("page")int page,
			@RequestParam("rows")int rows,String clinicname){
		//进行分页
		Page<Object> pg = PageHelper.startPage(page, rows);
		JSONArray advice = applyser.findAdviceAll(clinicname);
		//进行数据格式转换和封装
		Map<String,Object> map = new HashMap<>();
		map.put("total", pg.getTotal());//封装总记录数
		map.put("rows", advice);//封装当前页的内容
		return map;
	}
	
	//查询医嘱详情
	@PostMapping("find-advicedetailsall")
	@ResponseBody
	public String findadvicedetailsall(Integer docadviceid) {
		JSONObject json =new JSONObject();
	    JSONArray detailsAll = applyser.selectAdviceDetailsAll(docadviceid);
	    json.put("result", detailsAll);
	    return json.toJSONString();
	}

	//根据安排的时间来查询在上班的医生
	@PostMapping("select-opsanarrdoctor")
	@ResponseBody
	public JSONArray selectOpsanarrdoctor(Date daytime,String starttime,String endtime,Integer sectionid) {
		return us.selectopsanarrdoctor(daytime, starttime, endtime, sectionid);
	}
	
	//新增手术安排（手术安排表，住院表，用户表【医生，护士】，手术室，手术类型）
	@PostMapping("add-opsArrange")
	@ResponseBody
	public String AddopsArrange(@RequestParam("hospid")String hospid,
			@RequestParam("hospdoctorname")Integer hospdoctorname,
			@RequestParam("hospnursename")Integer hospnursename,
			@RequestParam("oproom")Integer oproom,
			@RequestParam("optype")Integer optype,
			@RequestParam("futruemoney")BigDecimal futruemoney,
			@RequestParam("dateday")String dateday,
			@RequestParam("starttime")String starttime,
			@RequestParam("reason")String reason,
			@RequestParam("endtime")String endtime) {
		
		
		    String arrange = applyser.AddOpreArrange(oproom, hospdoctorname, hospnursename, optype, 
				   hospid, reason, starttime, endtime, futruemoney, dateday);
			if("".equals(arrange)) {
				return "安排成功";
			}
		
			return arrange;
	
	}
	


	//开立体检（新增体检表，医疗卡表，项目表）
	@PostMapping("add-health")
	@ResponseBody
	public void AddHealth(String hospid,String project_arr,String totalmoney,
			Integer projectno,Integer lookillnessid,
			Integer clinicid,Integer healthmoneystatus,Integer healthtype) {
		
		applyser.AddHealth(hospid, project_arr, totalmoney, 
				projectno, lookillnessid, clinicid, 0, 0);
		
		
	}

	//进入护士站界面
	@RequestMapping("in-nursestand")
	public void inNursestand() {
		
	}
	
	//初始化医疗卡得下拉列表
	@PostMapping("init-clinic")
	@ResponseBody
	public JSONArray initclinic() {
		return	applyser.selectnotAdviceByclinic();
	}
	
	//初始化领药的信息
	@RequestMapping("init-selectAdvice")
	@ResponseBody
	public JSONArray selectAdviceByclincid() {
		return applyser.selectAdviceDetailsBYclinic();
	}
	
	
	
	@PostMapping("init-executeadvice")
	@ResponseBody
	public JSONArray selectapplydrugAll() {
		return applyser.selectapplydrugAll();
	}
	
	//申请领药
	@PostMapping("add-applydrug")
	@ResponseBody
	public String AddapplyDrug(DrugfyVo dvo){
		String addapplyDrug = applyser.AddapplyDrug(dvo);
		if("".equals(addapplyDrug)) {
			return "申请成功";
		}
		return addapplyDrug;
    }
	
	
	//初始化为执行医嘱的表格
	@PostMapping("find-notadviceall")
	@ResponseBody
	public Map<String,Object>  selectNotAdviceAll(@RequestParam("page")int page,
			@RequestParam("rows")int rows,String clinicname,String doctorname,String drugname){
		//进行分页
		Page<Object> pg = PageHelper.startPage(page, rows);
		JSONArray notadvice = applyser.selectNotAdviceDetails(clinicname,doctorname,drugname);
		//进行数据格式转换和封装
		Map<String,Object> map = new HashMap<>();
		map.put("total", pg.getTotal());//封装总记录数
		map.put("rows", notadvice);//封装当前页的内容
		return map;
	}
	
	//新增病程记录[执行医嘱]
	@PostMapping("add-illnessrecord")
	public void AddIllnessRecord(String hospId,Integer docdetailsId,
			String illOperator,String illDrugcount,String illHz,
			@RequestParam("drugno")Integer drugno) {
		
		applyser.AddIllnessRecord(hospId, docdetailsId,null,
				illOperator, illDrugcount, illHz,drugno);
		
	}
	
	//催缴押金
	@PostMapping("add-paymoney")
	@ResponseBody
	public void  addpaymoney(String hospId,BigDecimal cashDmoney,String cashOperatorName) {
		applyser.addpaymoney(hospId, cashDmoney,cashOperatorName);
	}
	
	//查询当天的病程记录
	@PostMapping("select-intraday")
	@ResponseBody
	public Map<String,Object>  selectintraday(@RequestParam("page")int page,
			@RequestParam("rows")int rows,String cname){
		//进行分页
		Page<Object> pg = PageHelper.startPage(page, rows);
		JSONArray alladviceday = applyser.selectTradayNessRecordAll();
		//进行数据格式转换和封装
		Map<String,Object> map = new HashMap<>();
		map.put("total", pg.getTotal());//封装总记录数
		map.put("rows", alladviceday);//封装当前页的内容
		return map;
	}
	
	
	//初始化病程记录的表格
	@PostMapping("init-nessrecord")
	@ResponseBody
	public Map<String,Object>  initNessRecordAll(@RequestParam("page")int page,
			@RequestParam("rows")int rows,String cname){
		//进行分页
		Page<Object> pg = PageHelper.startPage(page, rows);
		JSONArray alladvice = applyser.selectNessRecordAll(cname);
		//进行数据格式转换和封装
		Map<String,Object> map = new HashMap<>();
		map.put("total", pg.getTotal());//封装总记录数
		map.put("rows", alladvice);//封装当前页的内容
		return map;
	}
	
	//新增日结单
	@PostMapping("addpay-day")
	@ResponseBody
	public void addPayDay(String arr,String drugtotal,String dayOpreator) {
		applyser.addPayDay(arr, drugtotal, dayOpreator);
	}
	
	//初始化床位的记录的表格
	@PostMapping("init-bedrecord")
	@ResponseBody
	public Map<String,Object>  initbedrecord(@RequestParam("page")int page,
			@RequestParam("rows")int rows,String sickname,String hospid){
		//进行分页
		Page<Object> pg = PageHelper.startPage(page, rows);
		JSONArray alladvice = applyser.findhospRecored(sickname,hospid);
		//进行数据格式转换和封装
		Map<String,Object> map = new HashMap<>();
		map.put("total", pg.getTotal());//封装总记录数
		map.put("rows", alladvice);//封装当前页的内容
		return map;
	}
	
	//查询调整的记录的表格
	@PostMapping("find-changebedrecord")
	@ResponseBody
	public JSONArray findChangeBed(String hospid) {
		return applyser.selectChangeBedBybedid(hospid);
	}
	
	
	//扣除每天住院的床位租金
	@PostMapping("deduck-cashmoney")
	@ResponseBody
	public String deduckCashmoney(String hospid,BigDecimal money) {
		String	deduckmoney = applyser.deduckCashmoney(hospid, money);
		JSONObject json = new JSONObject();
		json.put("result",deduckmoney);
		return json.toJSONString();
	}
	
	//所搜住院号查询之前的床位号（调整床位）
	@PostMapping("changebedbyhospid")
	@ResponseBody
	public String changeBedbyhospid(String hospid) {
		JSONArray bedByhospid = applyser.selectChangeBedByhospid(hospid);
		JSONObject json = new JSONObject();
		json.put("result",bedByhospid);
		return json.toJSONString();
		
	}
	
	//新增调整床位
	@PostMapping("add-changebed")
	public void addChangeBed(String hospId,Integer bedId,Integer bedNo,String bedchangePeople) {
		applyser.addChangeBed(hospId, bedId, bedNo,bedchangePeople);
	}
	
	
	
	//新增床位
	@PostMapping("add-bed")
	public void AddBed(String bedNo,BigDecimal bedMoney,Integer sickroomName) {		
		applyser.AddBed(bedNo, bedMoney, sickroomName);
	}
	
	
	
	//进入押金管理界面
	@RequestMapping("in-cashmoney")
	public void inCashmoney() {
		
	}
	
	//体检项目退费
	@RequestMapping("returns-healmoney")
	@ResponseBody
	public void returnhealmoney(String hospId,Integer clinicId,
			@RequestParam("returnhealcashDmoney")BigDecimal returnhealcashDmoney){
		applyser.updatehealmoneysate(hospId,clinicId,returnhealcashDmoney);
	}
	
	//住院期间的交费记录（初始化表格）
	@RequestMapping("init-ReturnMoney")
	@ResponseBody
	public Map<String,Object>  initReturnMoneyAll(@RequestParam("page")int page,
			@RequestParam("rows")int rows){
		//进行分页
		Page<Object> pg = PageHelper.startPage(page, rows);
		JSONArray returnmoney = applyser.selectReturnMoneyAll();
		//进行数据格式转换和封装
		Map<String,Object> map = new HashMap<>();
		map.put("total", pg.getTotal());//封装总记录数
		map.put("rows", returnmoney);//封装当前页的内容
		return map;
	}

	
	//费用清单的初始化表格
	@PostMapping("init-feelist")
	@ResponseBody
	public JSONArray initFeeList(String hospid) {
		return applyser.selectfeelist(hospid);
	}
	
	@PostMapping("init-feelisttwo")
	@ResponseBody
	public JSONArray selecthealthall(String hospid) {
		return applyser.selecthealthall(hospid);
	}
	
	@RequestMapping("init-hospretruemoney")
	@ResponseBody
	public JSONArray selectOutHospReturnRecord() {
		return applyser.selectOutHospReturnRecord();
	} 
	
	
	//结算的确定按钮（新增return_money表）
	@RequestMapping("add-feemoney")
	public void AddFeeList(String hospId,BigDecimal returnmoneyMoney,Integer status) {
		applyser.AddFeeList(hospId, returnmoneyMoney, 2);
	}  
	
	//初始化退费的记录
	@RequestMapping("init-returnfeelist")
	@ResponseBody
	public JSONArray initReturnFeeList() {
		return applyser.selectReturnFeeAll();
	}  
	
	//出院时多退少补【交钱】,欠费时
	@RequestMapping("add-returnoutfeemoney")
	public void addreturnoutfeemoney(String hospId,BigDecimal returnmoneyMoney,Integer status) {
		applyser.AddFeeList(hospId, returnmoneyMoney, -1);
	}
	
	
	//进入出院界面
	@RequestMapping("in-outhospital")
	public void inOutHospital() {
		
	}
	
	//查询出院的记录
	@RequestMapping("init-outhosprecord2")
	@ResponseBody
	public Map<String,Object>  selectOutHospRecord2(@RequestParam("page")int page,
			@RequestParam("rows")int rows,String clinicname,Integer outid){
		//进行分页
		Page<Object> pg = PageHelper.startPage(page, rows);
		JSONArray outrecord = applyser.selectOutHospRecord2(clinicname,outid);
		//进行数据格式转换和封装
		Map<String,Object> map = new HashMap<>();
		map.put("total", pg.getTotal());//封装总记录数
		map.put("rows", outrecord);//封装当前页的内容
		return map;
	}

	//用于欠费
	@RequestMapping("init-outhosprecord")
	@ResponseBody
	public JSONArray  selectOutHospRecord() {
		return applyser.selectOutHospRecord();
	}
	
	//出院的按钮（新增出院表）
	@RequestMapping("add-outhosptail")
	public void AddOutHosptails(String hospId,BigDecimal outTotalmoney,
			String outOpreator,String outAdvice,Integer bedid) {
		System.out.println("床位号的主键："+bedid);
		applyser.AddOutHosptails(hospId, outTotalmoney,outOpreator,outAdvice,bedid);
	}
	
	
	//测试的界面
	@RequestMapping("demos")
	public void indemo() {
		
	}
	
	//进入手术台
	@RequestMapping("operation")
	public void operation(Model model) {
		//生成随机数形成住院号
		int recordid=(int)((Math.random()*4+1)*100000);
		model.addAttribute("recordid", recordid);
	}
	
	//初始化手术安排的表格
	@RequestMapping("init-arrangerecord")
	@ResponseBody
	public  Map<String,Object>  initArrangerecord(
			@RequestParam("page")int page,
			@RequestParam("rows")int rows){
			//进行分页
			Page<Object> pg = PageHelper.startPage(page, rows);
			JSONArray arrange = applyser.selectArrangeStatusAll();
			//进行数据格式转换和封装
			Map<String,Object> resultmap = new HashMap<>();
			resultmap.put("total", pg.getTotal());//封装总记录数
			resultmap.put("rows", arrange);//封装当前页的内容

			return resultmap;
	}

	//取消安排（修改手术安排的状态为-1）
	@PostMapping("update-arrange")
	@ResponseBody
	public void updateArrangeStatus(Integer operation_id,BigDecimal oparrange_money,String hosp_id) {
		applyser.updateArrangeStatus(-1, operation_id,oparrange_money,hosp_id);
	}
	
	//进行手术（新增手术记录）
	@PostMapping("add-opsingrecord")
	@ResponseBody
	public void AddOpsingRecord(Integer operationId,String opRecordPeople,
			String opRecordBegintime,String opRecordEndtime,
			BigDecimal opRecordMoney,String hospId,String oprecordresult) {		
			
		applyser.AddOpsingRecord(operationId, opRecordPeople, 
					opRecordBegintime, opRecordEndtime, opRecordMoney,hospId,oprecordresult);
			
	}
	
	//新增手术项目
	@PostMapping("add-opreationtype")
	@ResponseBody
	public void addOpreationtype(Integer operationroomId,
			    String operationtypeName,BigDecimal operationroomPrice) {	
		
			applyser.addOpreationtype(operationroomId, 
					operationtypeName, operationroomPrice);
	}
	
	//初始化手术记录
	@RequestMapping("init-oprecord")
	@ResponseBody
	public  Map<String,Object>  initOprecord(
			@RequestParam("page")int page,
			@RequestParam("rows")int rows){
			//进行分页
			Page<Object> pg = PageHelper.startPage(page, rows);
			JSONArray record = applyser.selectRecordAll();
			//进行数据格式转换和封装
			Map<String,Object> resultmap = new HashMap<>();
			resultmap.put("total", pg.getTotal());//封装总记录数
			resultmap.put("rows", record);//封装当前页的内容
			return resultmap;
	}
		
	//初始化体检套餐
	@RequestMapping("init-mealprojectall")
	@ResponseBody
	public JSONArray selectMealProjectAll() {
		return applyser.selectMealProjectAll();
	}
	
	@PostMapping("selectInhospital_storage")
	@ResponseBody
	public JSONArray selectInhospital_storageBydrug_number(Integer drug_number) {
		return applyser.selectInhospital_storageBydrug_number(drug_number);
	}
	
	

}
